<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/webApp/head.jsp" %>

<body style=" background: #fff;">

<div class="am-slider am-slider-default" data-am-flexslider id="demo-slider-0" style="border-bottom: 1px solid #b6b6b6;">
  <ul class="am-slides">
    <li><img src="${model.picture }"/></li>
    
  </ul>
  <div class="am-header-left am-header-nav return">

		<a href="javascript:history.back()" class="return-fir">
			<i class="am-icon-chevron-left"></i>
		</a>
		<a href="javascript:;" class="share"></a>
		<a href="" class="xin"></a>
  </div>
  <div class="share-con">
  	<a href="" class="friend"></a>
  	<a href="" class="zone"></a>
  	<a href="" class="weixin"></a>
  	<a href="" class="qq"></a>
  	<a href="" class="sina"></a>
  </div>
 
</div>

<div class="content">
	<div class="title">${model.name}</div>
	<div class="con">
	  <div class="price">￥<span>${model.price}</span></div>
	   <div class="p-pur">
        <a class="decrease" onclick="delNum()">-</a>
        <em class="sy_num">
        <input id="num" type="text" style="text-align:center" size=1 value="0" onchange="changeNum();" onkeyup="value=value.replace(/[^1234567890]+/g,'')"/>
        </em>
        <a class="increase" onclick="addNum()">+</a>   
      </div>
	</div>
</div>
<div class="con-num">
	<span class="con-num-l">库存/购买数</span>
	<span class="con-num-r">${model.inventoryNum}/${model.orderNum }</span>
</div>
<div class="con-num">
<span class="con-num-l">鞋子的尺码</span>
<!--  <div class="am-form-group"> -->
 <c:forEach  items="${sizeList}" var="list">
      <label class="am-checkbox-inline">
      <input type="radio" name="doc-radio-1" value="${list}">${list}
       
      </label>
     </c:forEach>
    
<!--     </div> -->
    </div>
 
<div title="详细" id="com_con" class="content" style="border-color: #ffffff">
	<div id="con-right" class='am-kai'>合计：<div id="total_price" style="font: normal;font-size: 50px;color: orange;"></div></div>
</div>
<hr data-am-widget="divider" style="" class="am-divider am-divider-default" />
 
<div title="评论区" id="com_info" class="content" style="border-color: #ffffff">
	 
</div>
<hr data-am-widget="divider" style="" class="am-divider am-divider-default" />
 <a class="con-num" href="procomment.html">
	<span class="con-num-l">商品的简介:${model.account}</span>

	
</a>
<a class="con-num" href="procomment.html">
	<span class="con-num-l">卖家:${model.userInfo.name }</span>

</a>
<%-- <a class="con-num" href="procomment.html">
	<span class="con-num-l">卖家:${model.userInfo.name }</span>
	<i class="am-icon-angle-right" style=" float:right; color: #b4b4b4;"></i>
	
</a>
 --%>
<a class="con-num" href="/shoeHouse/home/procomment?commId=${model.id}">
	<span class="con-num-l">商品评价</span>
	<i class="am-icon-angle-right" style=" float:right; color: #b4b4b4;"></i>
	
</a>
<a class="con-num" href="/shoeHouse/home/account?text=${model.commodifyDexc}">
	<span class="con-num-l">商品的描述</span>
	<i class="am-icon-angle-right" style=" float:right; color: #b4b4b4;"></i>
	
</a>
<div class="con-num">
<span class="con-num-l">地址:</span>
<p><input type="text" name="address" class="am-form-field am-radius" placeholder="地址" /></p>
</div>
<div class="con-num">
<span class="con-num-l">手机:</span>
<p><input type="text" name="phone" class="am-form-field am-radius" placeholder="手机" /></p>
</div>
 <div class="am-radio">
			<label> <input type="radio" name="way" value="未付款"
				> <img src="/shoeHouse/webApp/images/new/w12.png" width="30"
				height="30"> <span
				style="font: normal; font-size: 15px; color: gray;">未付款</span>
			</label>
		</div>
 <div class="am-radio">
			<label> <input type="radio" name="way" value="货到付款"
				checked> <img src="/shoeHouse/webApp/images/new/df.png" width="30"
				height="30"> <span
				style="font: normal; font-size: 15px; color: gray;">货到付款</span>
			</label>
		</div>

		<div class="am-radio">
			<label> <input type="radio" name="way"
				disabled="disabled" value="微信支付"><img
				src="/shoeHouse/webApp/images/new/wpay.jpg" width="30" height="30"> <span
				style="font: normal; font-size: 15px; color: gray;">微信支付(暂未开通)</span>
			</label>
		</div>


<div class="shop-cart">

 <a href="#" onclick="commBuy()">确认订单</a>        
 
 
 </div>

<%-- <div class="shop-cart">
  <span><i class="am-icon-shopping-cart am-icon-sm"></i><div style="color: green;" id="gwc"></div></span> 
  
 <a href="#"  onclick="location.href='${ctx }/mobile/confirmOrder?comId=${id}&count='+document.getElementById('num').value;return false;" target="_self">立即购买</a>        
 </div>
 --%>

  
 
<script>

var nowPrice = ${model.price};
var totalPrice=0;
var commId=${model.id };
var seller=${model.createId}

function commBuy(){
	var way=$("input[name='way'][checked]").val(); 
	var size=$("input[name='doc-radio-1']:radio:checked").val(); 
	var phone=$("input[name='phone']").val(); 
	var address=$("input[name='address']").val(); 
	
	var commNum=document.getElementById('num').value;
	alert(phone);
	if(phone==""){alert("请填写手机号");
	return;}
	if(address==""){alert("请填写地址");
	return;}
	
	if(commNum!=0){
		if(size!=undefined){
		location.href='/shoeHouse/home/commodifyBuy?commodifyId='+commId+'&number='+commNum+'&price='+totalPrice+'&way='+way+'&seller='+seller+'&shoeSize='+size+'&phone='+phone+'&address='+address;
		}else{
			
			alert("请选择鞋子的尺码");
		}
		
	}else{
		
		alert("商品数量不能为0");
	}
	
	
}
function addNum(){
	$("#gwc").empty();
	$("#total_price").empty();
	var num = $('#num').val();

	num++;
/* 	if(num > nowNumber){
		num = nowNumber;
	} */
	totalPrice=num*nowPrice;
	$('#num').val(num);
	$("#total_price").append("￥"+num*nowPrice);
	$("#gwc").append(num);
}
function delNum(){
	$("#gwc").empty();
	$("#total_price").empty();
	var num = $('#num').val();
	if(num > 1){
		num--;
	}
	/* if(num > nowNumber){
		num = nowNumber;
		$('#num').val(num);
	} */
	$('#num').val(num);
	totalPrice=num*nowPrice;
	$("#total_price").append("￥"+num*nowPrice);
	$("#gwc").append(num);
}


function changeNum(){
	$("#gwc").empty();
	$("#total_price").empty();
	var num = $('#num').val();
	if(num > nowNumber){
		num = nowNumber;
		$('#num').val(num);
	}
	$("#gwc").append(num);
	$("#total_price").append("￥"+num*nowPrice);
}

			$(function(){
        		$(".share").click(function(){
        			$(".share-con").fadeToggle()
        		})
        	})
</script>

 <%@include file="/webApp/bottom.jsp" %>
</body>
</html>